<h1>Showing document</h1>

<p>
  <b>Issue date:</b>
  <%=h @document.issue_date.strftime('%Y-%m-%d') %>
</p>

<p>
  <b>Type:</b>
  <%=h @document.document_type %>
</p>

<p>
  <b>Number:</b>
  <%=h @document.number %>
</p>

<p>
  <b>Source:</b>
  <%= link_to @document.source.name, @document.source %>
</p>

<p>
  <b>Target:</b>
  <%= link_to @document.target.name, @document.target %>
</p>

<p>
  <b>Positions:</b>
  <ul>
  <% @document.positions.each do |position| %>
    <li>
	<% product = Product.find_by_id(position.product_id) %>
    <%= link_to product.name, product %> - <%= position.quantity %> <%= product.unit %>
	</li>
  <% end %>
  </ul>
</p>

<p>
  <b>Notes:</b>
  <%=h @document.notes %>
</p>

<p>
  <b>Creator:</b>
  <%=h @document.employee.name + " " + @document.employee.surname %>
</p>

<%= link_to 'Edit', edit_document_path(@document) %> |
<%= link_to 'Delete', @document, :confirm => 'Are you sure?', :method => :delete %> |
<%= link_to 'List', documents_path %>